home *** CD-ROM | disk | FTP | other *** search
- Path: gail.ripco.com!mambuhl
- From: mambuhl@ripco.com (Martin Ambuhl)
- Newsgroups: comp.lang.c
- Subject: Re: Borland in-line asm
- Date: 3 Mar 1996 21:07:08 GMT
- Organization: Ripco Communications, Inc.
- Message-ID: <4hd1ls$1tj@gail.ripco.com>
- NNTP-Posting-Host: golden.ripco.com
-
- Bas Broers <B.P.Broers@student.utwente.nl> in
- <3139B06E.40C5@student.utwente.nl> asks:
-
- >Maybe a simple question, but how can i define a label in BASM (borland in-line
- >ssambler).
- >For example this program
-
- [example snipped]
-
- [begin mea culpa]
- Before giving an answer, I should note that I am wrong to do so. The
- newsgroup comp.lang.c is for discussion about C. BASM is a completely
- different language and, furthermore, is highly platform-specific. This
- type of question is properly asked in another group, such as
- comp.os.msdos.programmer.
- [end mea culpa]
-
- [begin optional material]
- Why do most gcc users know to ask about asm programming in a gnu.* group
- or, for dj's dos port, in comp.os.msdos.djgpp, but many Borland and
- Microsoft users think comp.lang.c is a dumping ground? The few gcc/djgpp
- users who _do_ ask such questions here deserve whatever the bcc, tcc,
- msc etc. users dump on them, of course.
- [end optional material]
-
- Some versions of Borland's compilers come with a file `~/doc/basm.doc';
- others include this text in the printed documentation. Always check
- your own documentation before posting. In it, you should have
- discovered:
- [from p4]
- Jump instructions
- =======================================================
-
- Jump instructions are treated specially. Since a label
- cannot be included on the instruction itself, jumps
- must go to C labels (discussed in "Using jump
- instructions and labels" on page 8). The allowed jump
- instructions are given in the next table.
- [from p8]
- ------------------ You can use any of the conditional and unconditional
- Using jump jump instructions, plus the loop instructions, in
- instructions and inline assembly. They are only valid inside a function.
- labels Since no labels can be defined in the asm statements,
- ------------------ jump instructions must use C goto labels as the object
- of the jump. If the label is too far away, the jump
- will be automatically converted to a long-distance
- jump. Direct far jumps cannot be generated.
- [from p9]
- In the following code, the jump goes to the C goto
- label a.
-
- int x()
- {
- a: /* This is the goto label "a" */
- ...
- asm jmp a /* Goes to label "a" */
- ...
- }
-
- Indirect jumps are also allowed. To use an indirect
- jump, you can use a register name as the operand of the
- jump instruction.
-
- --
- * Martin Ambuhl net: mambuhl@ripco.com
- * Chicago, IL (USA)
-